﻿using System;


public class Rect
{
    // 矩形的宽和高属性
    public double Width { get; set; }
    public double Height { get; set; }

   
    public Rect(double width, double height)
    {
        Width = width;
        Height = height;
    }

    
    public Rect() : this(10, 10)
    {
    }

    
    public double Area()
    {
        return Width * Height;
    }

 
    public double Perimeter()
    {
        return 2 * (Width + Height);
    }
}


public class PlainRect : Rect
{
    // 矩形左上角坐标属性
    public double StartX { get; set; }
    public double StartY { get; set; }

  
    public PlainRect(double startX, double startY, double width, double height)
        : base(width, height)
    {
        StartX = startX;
        StartY = startY;
    }

   
    public PlainRect() : this(0, 0, 0, 0)
    {
    }

  
    public bool IsInside(double x, double y)
    {
        // 点在矩形内的条件：x在[StartX, StartX + Width]范围内，且y在[StartY - Height, StartY]范围内
        return x >= StartX && x <= StartX + Width && y >= StartY - Height && y <= StartY;
    }
}


class Program
{
    static void Main(string[] args)
    {
        // 创建一个左上角坐标为（10，10），长为20，宽为10的矩形对象
        PlainRect rect = new PlainRect(10, 10, 20, 10);

        // 计算并打印输出矩形的面积和周长
        Console.WriteLine($"矩形的面积: {rect.Area()}");
        Console.WriteLine($"矩形的周长: {rect.Perimeter()}");

        // 判断点(25.5，13)是否在矩形内，并打印输出相关信息
        double x = 25.5;
        double y = 13;
        bool isInside = rect.IsInside(x, y);

        if (isInside)
        {
            Console.WriteLine($"点({x}, {y})在矩形内");
        }
        else
        {
            Console.WriteLine($"点({x}, {y})不在矩形内");
        }
    }
}
